﻿using UnityEngine;
using System.Collections;

public class ValuableGameLogic : GameLogic {

	ValuableSpawnerScript setupScript;
	SpriteRenderer[] Valuables;
	// Use this for initialization
	void Start () {
		Setup ();
	}
	void Setup()
	{
		setupScript = this.gameObject.GetComponent<ValuableSpawnerScript> ();
	}
	void Lose()
	{
		Result (false);
		}
	// Update is called once per frame
	void Update () {
		Valuables = this.transform.Find ("_Valuables").GetComponentsInChildren<SpriteRenderer> ();
		if (Valuables.Length == 0 && setupScript.valuablesToSpawn < 1)
						Result (true);
	}
}
